package jmine.tec.environment.db;

import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;

import org.apache.commons.dbcp.BasicDataSource;

/**
 * @author galmeida (Oct 28, 2008)
 */
public class P6DataSource extends BasicDataSource {
    private com.p6spy.engine.spy.P6DataSource ds;

    private BasicDataSource rds;

    /**
     * Construtor.
     * 
     * @param rds datasource a ser emcapsulado no {@link com.p6spy.engine.spy.P6DataSource}.
     */
    public P6DataSource(BasicDataSource rds) {
        this.rds = rds;
        this.ds = new com.p6spy.engine.spy.P6DataSource(rds);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean equals(Object obj) {
        return this.ds.equals(obj);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Connection getConnection() throws SQLException {
        return this.ds.getConnection();
    }

    /**
     *{@inheritDoc}
     */
    @Override
    public Connection getConnection(String username, String password) throws SQLException {
        return this.ds.getConnection(username, password);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int getLoginTimeout() throws SQLException {
        return this.ds.getLoginTimeout();
    }

    /**
     *{@inheritDoc}
     */
    @Override
    public PrintWriter getLogWriter() throws SQLException {
        return this.ds.getLogWriter();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int hashCode() {
        return this.ds.hashCode();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setLoginTimeout(int inVar) throws SQLException {
        this.ds.setLoginTimeout(inVar);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setLogWriter(PrintWriter inVar) throws SQLException {
        this.ds.setLogWriter(inVar);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        return this.ds.toString();
    }

    /**
     *{@inheritDoc}
     */
    @Override
    public void addConnectionProperty(String name, String value) {
        this.rds.addConnectionProperty(name, value);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void close() throws SQLException {
        this.rds.close();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean getDefaultAutoCommit() {
        return this.rds.getDefaultAutoCommit();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getDefaultCatalog() {
        return this.rds.getDefaultCatalog();
    }

    /**
     *{@inheritDoc}
     */
    @Override
    public boolean getDefaultReadOnly() {
        return this.rds.getDefaultReadOnly();
    }

    /**
     *{@inheritDoc}
     */
    @Override
    public int getDefaultTransactionIsolation() {
        return this.rds.getDefaultTransactionIsolation();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getDriverClassName() {
        return this.rds.getDriverClassName();
    }

    /**
     *{@inheritDoc}
     */
    @Override
    public int getInitialSize() {
        return this.rds.getInitialSize();
    }

    /**
     * {@inheritDoc}
     */
    @Deprecated
    @Override
    public boolean getLogAbandoned() {
        return this.rds.getLogAbandoned();
    }

    /**
     *{@inheritDoc}
     */
    @Override
    public int getMaxActive() {
        return this.rds.getMaxActive();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int getMaxIdle() {
        return this.rds.getMaxIdle();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int getMaxOpenPreparedStatements() {
        return this.rds.getMaxOpenPreparedStatements();
    }

    /**
     *{@inheritDoc}
     */
    @Override
    public long getMaxWait() {
        return this.rds.getMaxWait();
    }

    /**
     *{@inheritDoc}
     */
    @Override
    public long getMinEvictableIdleTimeMillis() {
        return this.rds.getMinEvictableIdleTimeMillis();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int getMinIdle() {
        return this.rds.getMinIdle();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int getNumActive() {
        return this.rds.getNumActive();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int getNumIdle() {
        return this.rds.getNumIdle();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int getNumTestsPerEvictionRun() {
        return this.rds.getNumTestsPerEvictionRun();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getPassword() {
        return this.rds.getPassword();
    }

    /**
     * {@inheritDoc}
     */
    @Deprecated
    @Override
    public boolean getRemoveAbandoned() {
        return this.rds.getRemoveAbandoned();
    }

    /**
     *{@inheritDoc}
     */
    @Deprecated
    @Override
    public int getRemoveAbandonedTimeout() {
        return this.rds.getRemoveAbandonedTimeout();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean getTestOnBorrow() {
        return this.rds.getTestOnBorrow();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean getTestOnReturn() {
        return this.rds.getTestOnReturn();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean getTestWhileIdle() {
        return this.rds.getTestWhileIdle();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public long getTimeBetweenEvictionRunsMillis() {
        return this.rds.getTimeBetweenEvictionRunsMillis();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getUrl() {
        return this.rds.getUrl();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String getUsername() {
        return this.rds.getUsername();
    }

    /**
     *{@inheritDoc}
     */
    @Override
    public String getValidationQuery() {
        return this.rds.getValidationQuery();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean isAccessToUnderlyingConnectionAllowed() {
        return this.rds.isAccessToUnderlyingConnectionAllowed();
    }

    /**
     *{@inheritDoc}
     */
    @Override
    public boolean isPoolPreparedStatements() {
        return this.rds.isPoolPreparedStatements();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void removeConnectionProperty(String name) {
        this.rds.removeConnectionProperty(name);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setAccessToUnderlyingConnectionAllowed(boolean allow) {
        this.rds.setAccessToUnderlyingConnectionAllowed(allow);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setDefaultAutoCommit(boolean defaultAutoCommit) {
        this.rds.setDefaultAutoCommit(defaultAutoCommit);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setDefaultCatalog(String defaultCatalog) {
        this.rds.setDefaultCatalog(defaultCatalog);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setDefaultReadOnly(boolean defaultReadOnly) {
        this.rds.setDefaultReadOnly(defaultReadOnly);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setDefaultTransactionIsolation(int defaultTransactionIsolation) {
        this.rds.setDefaultTransactionIsolation(defaultTransactionIsolation);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setDriverClassName(String driverClassName) {
        this.rds.setDriverClassName(driverClassName);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setInitialSize(int initialSize) {
        this.rds.setInitialSize(initialSize);
    }

    /**
     * {@inheritDoc}
     */
    @Deprecated
    @Override
    public void setLogAbandoned(boolean logAbandoned) {
        this.rds.setLogAbandoned(logAbandoned);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setMaxActive(int maxActive) {
        this.rds.setMaxActive(maxActive);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setMaxIdle(int maxIdle) {
        this.rds.setMaxIdle(maxIdle);
    }

    /**
     *{@inheritDoc}
     */
    @Override
    public void setMaxOpenPreparedStatements(int maxOpenStatements) {
        this.rds.setMaxOpenPreparedStatements(maxOpenStatements);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setMaxWait(long maxWait) {
        this.rds.setMaxWait(maxWait);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) {
        this.rds.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setMinIdle(int minIdle) {
        this.rds.setMinIdle(minIdle);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) {
        this.rds.setNumTestsPerEvictionRun(numTestsPerEvictionRun);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setPassword(String password) {
        this.rds.setPassword(password);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setPoolPreparedStatements(boolean poolingStatements) {
        this.rds.setPoolPreparedStatements(poolingStatements);
    }

    /**
     *{@inheritDoc}
     */
    @Deprecated
    @Override
    public void setRemoveAbandoned(boolean removeAbandoned) {
        this.rds.setRemoveAbandoned(removeAbandoned);
    }

    /**
     *{@inheritDoc}
     */
    @Deprecated
    @Override
    public void setRemoveAbandonedTimeout(int removeAbandonedTimeout) {
        this.rds.setRemoveAbandonedTimeout(removeAbandonedTimeout);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setTestOnBorrow(boolean testOnBorrow) {
        this.rds.setTestOnBorrow(testOnBorrow);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setTestOnReturn(boolean testOnReturn) {
        this.rds.setTestOnReturn(testOnReturn);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setTestWhileIdle(boolean testWhileIdle) {
        this.rds.setTestWhileIdle(testWhileIdle);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) {
        this.rds.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setUrl(String url) {
        this.rds.setUrl(url);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setUsername(String username) {
        this.rds.setUsername(username);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setValidationQuery(String validationQuery) {
        this.rds.setValidationQuery(validationQuery);
    }
}
